home *** CD-ROM | disk | FTP | other *** search
- /* GadTools layout toolkit
- **
- ** Copyright © 1993-1995 by Olaf `Olsen' Barthel
- ** Freely distributable.
- **
- ** :ts=4
- */
-
- #include "gtlayout_global.h"
-
- #ifdef DO_MENUS
-
- /* LTP_MakeMenu(RootMenu *Root,MenuNode *Menu,struct NewMenu *Template):
- *
- * Create a single menu and fill it in.
- */
-
- MenuNode * __regargs
- LTP_MakeMenu(RootMenu *Root,MenuNode *Menu,struct NewMenu *Template)
- {
- // If none is provided, roll our own
-
- if(!Menu)
- Menu = (MenuNode *)AsmAllocPooled(Root -> Pool,sizeof(MenuNode),SysBase);
-
- if(Menu)
- {
- STRPTR Label = Template -> nm_Label;
-
- // Use the screen font for the layout
-
- SetFont(&Root -> RPort,Root -> DrawInfo -> dri_Font);
-
- // Fill in the size
-
- Menu -> Menu . Width = TextLength(&Root -> RPort,Label,strlen(Label)) + 6;
- Menu -> Menu . Height = Root -> Screen -> BarHeight;
-
- Menu -> Menu . MenuName = (BYTE *)Label;
- Menu -> UserData = Template -> nm_UserData;
-
- // Return to the original font
-
- SetFont(&Root -> RPort,Root -> Font);
-
- // Take care of the only valid bit
-
- if(!(Template -> nm_Flags & NM_MENUDISABLED))
- Menu -> Menu . Flags = MENUENABLED;
- }
-
- return(Menu);
- }
-
- #endif /* DO_MENUS */
-